<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>学生管理系统-晴空</title>
	<link rel="stylesheet" href="<?php echo (HOME_CSS); ?>public.css">
	<link rel="stylesheet" href="<?php echo (HOME_CSS); ?>list.css">
	<script src="<?php echo (HOME_JS); ?>jquery.min.js"></script>
</head>
<body>
	<div id="header" class="header clearfix">
		<div class="logo left">
			晴空-学生管理系统
		</div>
		<ul class="header-nav right">
			<li>
				<a href="<?php echo U('Manager/login');?>">登陆</a>
			</li>
			<li>
				<a href="<?php echo U('Manager/logout');?>">退出系统</a>
			</li>
		</ul>
	</div>
	<div id="main-wrapper" class="clearfix">
		<div id="side" class="left">
			<ul>
				<h3>学生信息管理</h3>
				<?php if(strstr($auth_path, 'Student-showList') != false): ?><li><a href="<?php echo U('Student/showList');?>">查询学生信息</a></li><?php endif; ?>
				<?php if(strstr($auth_path, 'Student-addInfo') != false): ?><li><a href="<?php echo U('Student/addInfo');?>">录入学生信息</a></li><?php endif; ?>
			</ul>
			<ul>
				<h3>课程信息管理</h3>
				<?php if(strstr($auth_path, 'Course-showList') != false): ?><li><a href="<?php echo U('Course/showList');?>">查询课程</a></li><?php endif; ?>
				<?php if(strstr($auth_path, 'Course-addInfo') != false): ?><li><a href="<?php echo U('Course/addInfo');?>">录入课程</a></li><?php endif; ?>
			</ul>
			<ul>
				<h3>学生成绩管理</h3>
				<?php if(strstr($auth_path, 'Score-showList') != false): ?><li><a href="<?php echo U('Score/showList');?>">查询成绩</a></li><?php endif; ?>
				<?php if(strstr($auth_path, 'Score-addInfo') != false): ?><li><a href="<?php echo U('Score/addInfo');?>">录入成绩</a></li><?php endif; ?>
			</ul>
		</div>
		<div id="main" class="right">
			<h1>查询学生信息</h1>
<div id="cont">
	<?php if($role_id == 2): ?><!-- 学生和老师显示不同的内容 -->
		<link rel="stylesheet" href="<?php echo (HOME_CSS); ?>input.css">
		<form action="/qingkong/Home/Student/showList.html" method="POST" id="iForm">
			<p>
				<label for="">学号</label>
				<input type="text" value="<?php echo ($info["id"]); ?>" disabled>
			</p>
			<p>
				<label for="">班级</label>
				<input type="text" value="<?php echo (getClassName($info["class_id"])); ?>" disabled>
			</p>
			<p>
				<label for="">姓名</label>
				<input type="text" value="<?php echo ($info["name"]); ?>" disabled>
			</p>
			<p>
				<label for="">性别</label>
				<select name="gender" class="edit" id="" disabled>
					<option value="0" <?php echo ($info['gender'] == 0 ? 'selected' : ''); ?>>未选择</option>
					<option value="1" <?php echo ($info['gender'] == 1 ? 'selected' : ''); ?>>男</option>
					<option value="2" <?php echo ($info['gender'] == 2 ? 'selected' : ''); ?>>女</option>
				</select>
			</p>
			<p>
				<label for="">入学时间</label>
				<input type="text" value="<?php echo ($info["time"]); ?>" disabled>
			</p>
			<p>
				<label for="">地址</label>
				<input type="text" name="address" class="edit" value="<?php echo ($info["address"]); ?>" disabled>
			</p>
			<p>
				<label for=""></label>
				<a href="javascript:;" id="edit-btn" style="margin-left: 15px;color: #339933;">修改信息</a>
			</p>
		</form>
		<script>
			$(function(){
				$('body').delegate('#edit-btn', 'click', function(){
					$('.edit').attr('disabled', false);
					var html = '<button type="submit">保存</button><a href="javascript:;" id="edit-cancle-btn" style="margin-left: 15px;color: #339933;">取消修改</a>';
					$(this).after(html).remove();
				});
				$('body').delegate('#edit-cancle-btn', 'click', function(){
					$('.edit').attr('disabled', true);
					var html = '<a href="javascript:;" id="edit-btn" style="margin-left: 15px;color: #339933;">修改信息</a>';
					$(this).after(html);
					$(this).siblings('button').remove();
					$(this).remove();
				});
			});
		</script>
	<?php else: ?><!-- 以下是教师可查看内容 -->
		<div class="table-head clearfix">
			<div class="wrap left">
				<span>班级：</span>
				<select name="" id="class-select" class="class-select">
					<?php if(is_array($class_info)): foreach($class_info as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>" <?php echo ($v['id'] == $class_id ? 'selected' : ''); ?>><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
				</select>
			</div>
			<a href="<?php echo U('Course/addInfo');?>" class="input-btn right">录入信息</a>
		</div>
		<table id="table" class="table">
			<thead>
				<tr>
					<th>学号</th>
					<th>名字</th>
					<th>性别</th>
					<th>班级</th>
					<th>入学时间</th>
					<th>家庭住址</th>
				</tr>
			</thead>
			<tbody>
				<?php if(is_array($info)): foreach($info as $key=>$v): ?><tr>
						<td><?php echo ($v["id"]); ?></td>
						<td><?php echo ($v["name"]); ?></td>
						<td>
							<?php if($v["gender"] == 1): ?>男<?php elseif($v["gender"] == 2): ?>女<?php else: ?>保密<?php endif; ?>
						</td>
						<td><?php echo (getClassName($v["class_id"])); ?></td>
						<td><?php echo ($v["time"]); ?></td>
						<td><?php echo ($v["address"]); ?></td>
					</tr><?php endforeach; endif; ?>
			</tbody>
		</table>

		<script>
			$(function(){
				$('#class-select').change(function(){
					window.location.href = "<?php echo U('Student/showList');?>" + "?class_id=" + $(this).val();
				});
			});
		</script><?php endif; ?>
</div>
		</div>
	</div>
	<div class="footer" id="footer">
		<div class="copyright">
			copyright ---- 晴空
		</div>
	</div>
</body>
</html>